package cn.wd.mapper;

import cn.wd.domain.Employee;
import cn.wd.qo.QueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface EmployeeMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Employee record);

    Employee selectByPrimaryKey(Long id);

    /**
     * 通过部门 id 查询员工
     * @param deptId 部门 id
     * @return 所在部门下面的全部员工
     */
    List<Employee> selectByDepartmentPrimaryKey(Long deptId);

    List<Employee> selectAll();

    int updateByPrimaryKey(Employee record);

    Long selectForCount(QueryObject qo);

    List<Employee> selectForList(QueryObject qo);

    Employee selectByEmployeeName(String username);

    void restPassword(@Param("id") Long id, @Param("newPassword") String newPassword);

    void updateAvatar(@Param("id") Long id, @Param("avatar") String avatar);

    // 给员工分配部门
    void updateEmployeeDeptId(@Param("deptId") Long deptId, @Param("employeeIdArr") Long[] employeeIdArr);

}